<template>
  <el-button size="small" @click="dialogVisible = true">
    加入
  </el-button>

  <el-dialog
      v-model="dialogVisible"
      width="280"
      :before-close="handleClose"
      :append-to-body="true"
      draggable
  >
    <template #header>
      <div class="text-center">申请加入群聊</div>
    </template>
    <div class="flex">
      <el-avatar :size="50" :src="add_group.avater"/>
      <div class="flex *:w-full flex-wrap ml-2 text-[12px] items-center">
        <div>{{ add_group.name }}</div>
        <div>{{ add_group.account }}</div>
      </div>
    </div>
    <div class="mt-2">
      <div class="">填写验证信息</div>
      <div class="m-1">
        <el-input
            v-model="add_group_obj.check_content"
            style="width: 240px"
            :rows="2"
            type="textarea"
        />
      </div>
    </div>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="dialogVisible = false">
          发送
        </el-button>
        <el-button @click="dialogVisible = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import {ref} from 'vue'
import {storeToRefs} from "pinia";
import { useUserStore } from '@/store/user';

const userStore = useUserStore()
const {add_group_obj} = storeToRefs(userStore)
const props = defineProps(['add_group'])
const {add_group} = props

const dialogVisible = ref(false)

const handleClose = (done: () => void) => {
  dialogVisible.value = false
}
</script>